home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 1 (Walnut Creek)
/
Aminet - June 1993 [Walnut Creek].iso
/
aminet
/
util
/
pack
/
ppcompress095.lha
/
ppstdio.c
< prev
Wrap
C/C++ Source or Header
|
1992-11-14
|
639b
|
37 lines
#include <clib/dos_protos.h>
#include <clib/exec_protos.h>
#include <exec/types.h>
#include <stdio.h>
#include "ppcompress.h"
#define OUTSIZE 80
char *GetMyStdIn(char *);
BOOL PutMyStdOut(UBYTE *, int);
char *GetMyStdIn(char *tmp)
{
BPTR fh;
UBYTE c;
tmpnam(tmp);
if ( !(fh=Open(tmp, MODE_NEWFILE)) ) return(NULL);
while ( Read(Input(), &c, 1) ) Write(fh, &c, 1);
Close(fh);
return(tmp);
}
BOOL PutMyStdOut(UBYTE *buffer, int len)
{
int remain;
remain=len;
while( remain>0 ) {
if (USER_HIT_CTRL_C) return(FALSE);
Write(Output(), buffer, MIN(OUTSIZE, remain));
remain -= OUTSIZE;
buffer += OUTSIZE;
}
return(TRUE);
}